package com.lggry.code;

public class CodeDemo2 {
    private String name;
    private String[] direction  = new String[4];
    //实例代码块，无static修饰，属于对象，每次创建对象时都会优先执行依次
    //基本作用：初始化对象的实例资源。
    {
        System.out.println("实例代码块执行了");
        name = "lxy";
        direction[0] = "东";
        direction[1] = "南";
        direction[2] = "西";
        direction[3] = "北";
    }
    public static void main(String[] args) {
        //目标：实例代码块
        System.out.println("main方法执行了");
    }
}
